# -*- mode: snippet -*-
# name: sink template
# key: sink
# contributor : Shuguang Sun
# --
## sink() if being run non-interactively
if (sink.number() != 0) {sink()}
.script_name. <- gsub("^--file=", "", Filter(function(x) {grepl("^--file=", x)}, commandArgs()))
if (length(.script_name.) == 1) {
    sink(file = paste0(.script_name., ".txt"), split = TRUE)
    options(width = 100)
}